Product Code Database
Example Keywords: world of -shirt $23-192
   » » Wiki: Affinity Mask
Tag Wiki 'Affinity Mask'.
Tag

Affinity mask
 (

 C O N T E N T S 

An affinity mask is a bit mask indicating what processor(s) a thread or process should be run on by the scheduler of an . Setting the affinity mask for certain processes running under Windows can be useful as there are several system processes (especially on domain controllers) that are restricted to the first CPU / Core. So, excluding the first CPU might lead to better application performance.


Windows API
Thread affinity in Microsoft Windows can be specified with the SetThreadAffinityMask function. Forcing of each thread to distinctive cores in Windows can be accomplished by means of the following C code:
#include 
#include 
// Set OpenMP thread affinity
void set_thread_affinity () {
    #pragma omp parallel default(shared)
    {
        DWORD_PTR mask = (DWORD_PTR )1 << omp_get_thread_num();
        SetThreadAffinityMask(GetCurrentThread(), mask);
    }
}
     


See also
  • Processor affinity


External links

Page 1 of 1
1
Page 1 of 1
1

Account

Social:
Pages:  ..   .. 
Items:  .. 

Navigation

General: Atom Feed Atom Feed  .. 
Help:  ..   .. 
Category:  ..   .. 
Media:  ..   .. 
Posts:  ..   ..   .. 

Statistics

Page:  .. 
Summary:  .. 
1 Tags
10/10 Page Rank
5 Page Refs
1s Time